 % RK3.m

dt = CFL*hx;
t = 0;
sum=0;
while t < tend
    
    if t + dt >= tend
        dt = tend - t;
        t = tend;
        sum=sum+1;
    else
        t = t + dt;
        sum=sum+1;
    end
%     if sum==100
%         break
%     end
    % Stage I
    du = Lh(uh);
    uh1 = uh + dt*du;
    %uh1 = TVD_Limiter(uh1);
    %uh1=hybrid_Limiter(uh1);
    %uh1=Weno_Limiter(uh1);
    %uh1=SiWeno_Limiter(uh1);
    uh1=MR1_Weno_Limiter(uh1);
    %Stage II
     du = Lh(uh1);
    uh2 = (3/4)*uh + (1/4)*uh1 + (1/4)*dt*du;
    %uh2 = TVD_Limiter(uh2);
    %uh2=hybrid_Limiter(uh2);
    %uh2=Weno_Limiter(uh2);
    %uh2=SiWeno_Limiter(uh2);
    uh2=MR1_Weno_Limiter(uh2);
    %Stage III

    du = Lh(uh2);
    uh = (1/3)*uh + (2/3)*uh2 + (2/3)*dt*du;
    %uh = TVD_Limiter(uh);
    %uh=hybrid_Limiter(uh);
    %uh=Weno_Limiter(uh);
    %uh=SiWeno_Limiter(uh);
    uh=MR1_Weno_Limiter(uh);
    %fprintf('%d  %d\n',t,max(abs(uh(:,1))))
%      
 end